package controllers;

import java.util.List;

import models.Serie;
import models.dao.DAOSerie;
import play.mvc.Controller;
import play.mvc.Result;

public class CtrlSerie extends Controller{
	
	public static Result menu(){
		return ok(views.html.serie.menu.render());
	}
	
	public static Result inserir(){
		return ok(views.html.serie.inserir.render());
	}
	
	public static Result inserirOk(int numero){
		DAOSerie dao = new DAOSerie();
		Serie ser = new Serie();
		ser.numero = numero;
		dao.inserir(ser);
		
		return ok(views.html.serie.inserirok.render());
	}
	
	public static Result deletar(){
		return ok(views.html.serie.deletar.render());
	}
	
	public static Result deletarOk(int numero){
		DAOSerie dao = new DAOSerie();
		Serie ser = new Serie();
		ser.numero = numero;
		dao.deletar(ser);
		
		return ok(views.html.serie.deletarok.render());
	}
	
	public static Result listar(){
		DAOSerie dao = new DAOSerie();
		List<Serie> serie = dao.listar();
		
		return ok(views.html.serie.listar.render(serie));	
	}
	
}